package com.xzakota.minesweeper.msg;

import com.xzakota.minesweeper.log.XLogger;

/**
 * 登录消息默认处理器
 *
 * @author Xzakota
 */
public class SignInMsgDefaultHandler extends DefaultHandler {
    @Override
    public void handle(BaseMsg msg) {
        resultMsgText = switch (msg.code) {
            case MsgCode.BASE_SUCCESS -> "登录成功";
            case MsgCode.BASE_FAIL -> "登录失败";
            case MsgCode.SIGN_IN_USER_NOT_EXIST -> "用户不存在";
            case MsgCode.SIGN_IN_USER_ERROR_PASSWORD -> "密码错误";
            case MsgCode.SIGN_IN_USER_ONLINE -> "用户已在线";
            default -> throw new IllegalStateException("Unexpected value: " + msg.code);
        };

        XLogger.info(resultMsgText);
    }
}
